home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: news.uunet.ca!wildcan!sq!msb
- From: msb@sq.com (Mark Brader)
- Subject: Re: Is it legal to add 0 to NULL? What about NULL < NULL?
- Message-ID: <1996Apr8.053026.7583@sq.com>
- Summary: No, but the wrong question was asked
- Organization: SoftQuad Inc., Toronto, Canada
- References: <ff1d.smail.smayo@tiac.net> <828905693snz@genesis.demon.co.uk>
- Date: Mon, 8 Apr 1996 05:30:26 GMT
-
- > > Thing *a = A;
- > > Thing *fence = a + S;
- > > for (; a < fence; ++a)
- > > /* use a */;
- > >
- > > but in my case, if S happens to be 0, a will start out NULL.
-
- Er, no. If S happens to be 0, but A yields a valid Thing * pointer,
- then a and fence will both start out equal to that pointer value.
-
- If A is a null pointer or null pointer constant, *then* a will start
- out as a null pointer, and the undefined behavior described by Lawrence
- Kirby in the Referenced article will occur.
- --
- Mark Brader, msb@sq.com, SoftQuad Inc., Toronto
- "I'm a little worried about the bug-eater," she said. "We're embedded
- in bugs, have you noticed?" -- Niven, "The Integral Trees"
-
- My text in this article is in the public domain.
-